import Vue from "vue";
import App from "./App.vue";
import BaiduMap from "vue-baidu-map";
import router from "./router";
import "element-ui/lib/theme-chalk/index.css";
import ElementUI, { Table } from "element-ui";
import ChineseDictionary from "./assets/dictionary/ChineseDictionaryOfSystem.js";
import "./utils/request";
import echarts from "echarts";
Vue.prototype.$echarts = echarts;
// Vue.prototype.$axios = axios;
Vue.use(ChineseDictionary); // 引入中文字典
Vue.config.productionTip = false;

// 解决 ElTable 自动宽度高度导致的「ResizeObserver loop limit exceeded」问题
const fixElTableErr = (table) => {
  const oldResizeListener = table.methods.resizeListener;
  table.methods.resizeListener = function () {
    window.requestAnimationFrame(oldResizeListener.bind(this));
  };
};
// 一定要在Vue.use之前执行此函数
fixElTableErr(Table);
Vue.use(ElementUI);
// 定义全局变量
const LOCAL = Vue.observable({
  CHI: false,
  TITLE_INFO: "系统",
  USER_INF:{},
  ECHART: echarts,
  MAIN_ACTION_INDEX: 1,
  IS_LOGIN:false,
  MAIN_ACTION_LIST: ["datasource", "data-manage", "chatmoment", "mine"],
});
Vue.use(BaiduMap, {
  ak: "vCo2jlCFpRKc8y7FtIQHGznRGtBFfKuw",
});
export default LOCAL;
new Vue({
  router,
  // axios,
  render: (h) => h(App),
}).$mount("#app");
